
//package com.zoweunion.mechanic.socket;
//
//import java.io.BufferedReader;
//import java.io.InputStream;
//import java.io.InputStreamReader;
//import java.io.OutputStream;
//import java.io.PrintWriter;
//import java.net.Socket;
//
//public class SocketClient {
//	public static void main(String[] args) {
//		//1、创建客户端Socket，指定服务器地址和端口
//		while (true) {
//			Socket socket = null;
//			try {
//				socket = new Socket("127.0.0.1",8088);
//				//socket = new Socket("139.196.98.38",8088);
//				//2、获取输出流，向服务器端发送信息
//				OutputStream os = socket.getOutputStream();//字节输出流
//				//PrintWriter pw =new PrintWriter(os);//将输出流包装成打印流
////				pw.write("@"+bytesToHexString("le".getBytes())+"-"+bytesToHexString("id1".getBytes())+"-"+bytesToHexString("55555555".getBytes())
////				+"-"+bytesToHexString("id2".getBytes())+"-"+bytesToHexString("33332222".getBytes())
////				+"-"+bytesToHexString("id3".getBytes())+"-"+bytesToHexString("22223333".getBytes())+"*#\r\n");
//				//pw.write("你好,乔恩bbbbb");
//				//pw.flush();
//				os.write("你好,乔恩bbbbb*#\r\n".getBytes());
//				os.flush();
//				socket.shutdownOutput();
//				Thread.sleep(5000);
//				//3、获取输入流，并读取服务器端的响应信息
////				InputStream is = socket.getInputStream();
////				BufferedReader br = new BufferedReader(new InputStreamReader(is));
////				String info = null;
////				while((info=br.readLine())!= null){
////					System.out.println("我是客户端，服务器说："+info);
////					//TODO : 待写的业务逻辑代码 ! ! !
////
////				}
//				//4、关闭资源
////				br.close();
////				is.close();
//				//pw.close();
//				os.close();
//				//socket.setKeepAlive(true);
//				socket.close();
//				System.out.println("------------------------"+Thread.currentThread()+"------------------------------");
//			} catch (Exception e) {
//				e.printStackTrace();
//			}
//
//		}
//
//	}
//
//	public static final String bytesToHexString(byte[] bArray) {
//		StringBuffer sb = new StringBuffer(bArray.length);
//		String sTemp;
//		for (int i = 0; i < bArray.length; i++) {
//			sTemp =Integer.toHexString(0xFF & bArray[i]);
//			if (sTemp.length() < 2)
//				sb.append(0);
//			sb.append(sTemp.toUpperCase());
//		}
//		return sb.toString();
//	}
//
//}
